<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<h:head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>MYMSGRO</title>
	<link rel="stylesheet" type="text/css" href="css/main.css" />
	<link rel="stylesheet" type="text/css" href="css/meniu.css" />
	<link rel="stylesheet" type="text/css" href="css/style.css" />

</h:head>
<h:body>

	<ui:include src="header.xhtml" />

	<h:panelGroup layout="block" id="content">

		<ui:include src="leftMenu.xhtml" />

		<h:panelGroup layout="block" id="contenRight">

			<h:panelGroup layout="block" id="header" style="margin-top: 20px;">
				<ul>
					<li id="selected"><a>Add trainee</a></li>
				</ul>
			</h:panelGroup>

			<h:panelGroup layout="block" id="contentTab">
				<h:form id="formAddUser" enctype="multipart/form-data">
					<h:panelGrid columns="3">

						<h:outputText value="Username:" style="float: right"/>
						<h:inputText id="inputUsername" value="#{traineeDTO.username}"
							required="true" requiredMessage="Can't be blank">
						</h:inputText>
						<h:message for="inputUsername" style="color:red"/>

						<h:outputText value="First name:" style="float: right"/>
						<h:inputText id="inputFirstname" value="#{traineeDTO.firstname}"
							required="true" requiredMessage="Can't be blank" />
						<h:message for="inputFirstname" style="color:red"/>

						<h:outputText value="Last name:" style="float: right"/>
						<h:inputText id="inputLastname" value="#{traineeDTO.lastname}"
							required="true" requiredMessage="Can't be blank" />
						<h:message for="inputLastname" style="color:red"/>

						<h:outputText value="Work email:" style="float: right"/>
						<h:inputText id="inputWorkEmail" value="#{traineeDTO.workEmail}"
							required="true" validatorMessage="Email address is not valid"
							requiredMessage="Can't be blank">
							<f:validateRegex
								pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]" />
						</h:inputText>
						<h:message for="inputWorkEmail" style="color:red"/>

						<h:outputText value="Date of birth:" style="float: right"/>
						<h:inputText id="inputDateOfBirth" value="#{traineeDTO.dob}"
							required="true" requiredMessage="Can't be blank">
							<f:convertDateTime type="date" pattern="yyyy-MM-dd" />
						</h:inputText>
						<h:message for="inputDateOfBirth" style="color:red"/>

						<h:outputText value="Personal phone:" style="float: right"/>
						<h:inputText id="inputPersonalPhone"
							value="#{traineeDTO.personalPhone}" required="true"
							validatorMessage="Phone number is not valid. It needs to be between 10 and 14 digits."
							requiredMessage="Can't be blank" />
						<h:message for="inputPersonalPhone" style="color:red"/>

						<h:outputText value="Personal email:" style="float: right"/>
						<h:inputText id="inputPersonalEmail"
							value="#{traineeDTO.personalEmail}" required="true"
							validatorMessage="Email address is not valid"
							requiredMessage="Can't be blank">
							<f:validateRegex
								pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]" />
						</h:inputText>
						<h:message for="inputPersonalEmail" style="color:red"/>

						<h:outputText value="Employment date:" style="float: right"/>
						<h:inputText id="inputEmploymentDate"
							value="#{traineeDTO.employmentDate}" required="true"
							requiredMessage="Can't be blank">
							<f:convertDateTime type="date" pattern="yyyy-MM-dd" />
						</h:inputText>
						<h:message for="inputEmploymentDate" style="color:red"/>

						<h:outputText value="Last medical check date:" style="float: right"/>
						<h:inputText id="inputMedCheckUpDate"
							value="#{traineeDTO.medCheckUpDate}"
							requiredMessage="Can't be blank">
							<f:convertDateTime type="date" pattern="yyyy-MM-dd" />
						</h:inputText>
						<h:message for="inputMedCheckUpDate" />

						<h:outputText value="Employmen type:" style="float: right"/>
						<h:selectOneMenu id="inputEmploymentType"
							value="#{traineeDTO.employmentType}">
							<f:selectItem itemValue="CM" itemLabel="CM" />
							<f:selectItem itemValue="PFA" itemLabel="PFA" />
						</h:selectOneMenu>
						<h:message for="inputEmploymentType" />

						<h:outputText value="Position:" style="float: right"/>
						<h:inputText id="inputPosition" value="#{traineeDTO.position}"
							required="true" requiredMessage="Can't be blank" />
						<h:message for="inputPosition" />

						<h:outputText value="CV:" style="float: right"/>
						<h:inputFile id="uploadedFile" name="uploadFile"
							validator="#{employeeBean.validate}" />
						<h:outputText value="#{employeeBean.errorMessage}" />

						<h:outputText value="Salary" style="float: right"/>
						<h:inputText id="inputSalary" value="#{traineeDTO.salary}"
							required="true" requiredMessage="Can't be blank" />
						<h:message for="inputSalary" style="color:red"/>

						<h:outputText value="Roles:" style="float: right"/>
						<h:outputText />
						<h:outputText />

						<h:outputText value="Basic user (library and review)" style="float: right"/>
						<h:selectBooleanCheckbox id="inputBasicUser"
							value="#{employeeBean.basicUser}" />
						<h:outputText />

						<h:outputText/>
						<h:commandButton id="createUser" value="Save"
							action="#{employeeBean.addEmployee}">
							<f:param name="cicic" value="trainee" />
						</h:commandButton>

					</h:panelGrid>

				</h:form>
			</h:panelGroup>
		</h:panelGroup>
	</h:panelGroup>
</h:body>
</html>